<!DOCTYPE html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<html lang="zh-CN">
<head>
    <%@include file="/resource/common/head.jsp" %>
</head>
<script>
    function deleteSystem(systemName) {
        $("#deleteSystemForm input[name='systemName']").val(systemName);
    }
</script>
<body>
<div id="wrapper">
    <%@include file="/resource/common/navigator.jsp" %>
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12 ">
                 <h1 class="page-header">业务系统</h1>
            </div>
        </div>
        <div class="row">
            <c:forEach items="${systemNames}" var="systemName">
                <div class="col-lg-3 col-md-6">
                    <div class="panel panel-primary">
                        <div class="panel-heading">
                            <div class="row">
                                <div class="col-xs-3">
                                    <i class="fa fa-gear fa-5x"></i>
                                </div>
                                <div class="col-xs-9 text-right">
                                    <div class="huge">${systemName}</div>
                                </div>
                            </div>
                        </div>
                        <div class="panel-footer">
                        	<div class="pull-right">
                        		<button title="删除" type="button" class="btn btn-danger btn-circle" data-toggle="modal" data-target="#deleteSystemModal"
                                        onclick="deleteSystem('${systemName}')">
                                    <i class="fa fa-trash-o"></i>
                                </button>
                                <a title="下载配置明细" href="${basePath}/configs4system?operation=download&systemName=${systemName}" class="btn btn-success btn-circle"><i class="fa fa-download"></i></a>
                            	<a title="配置明细" href="${basePath}/configs4detail?systemName=${systemName}" class="btn btn-info btn-circle"><i class="fa fa-list"></i></a>       
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                </div>
            </c:forEach>
            <!-- 新增业务系统  begin-->
            <div class="col-lg-3 col-md-6">
                 <div class="panel panel-primary">
                     <div class="panel-body">
                     	<div class="text-center">
	                       <button title="新增业务系统" type="button" class="btn btn-info btn-circle btn-xl" data-toggle="modal" data-target="#saveSystemModal">
	                            <i class="fa fa-plus"></i>
	                 	   </button>
	                 	   <button title="上传业务系统配置" type="button" class="btn btn-info btn-circle btn-xl" data-toggle="modal" data-target="#uploadFileModal">
	                 	   		<i class="fa fa-upload"></i>
	                 	   </button>
                 	   </div>
                     </div>
                 </div>
             </div>
             <!-- 新增业务系统  end-->
        </div>
        <%--上传文件弹框--%>
        <div class="modal fade" id="uploadFileModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="saveOrUpdateModalLabel">上传初始化配置文件</h4>
                    </div>
                    <%--配置文件上传--%>
                    <form id="uploadForm" action="${basePath}/configs4system?operation=upload" method="post" enctype="multipart/form-data">
                        <div class="modal-body">
                            <div class="form-group">
                                <input type="file" name="uploadConfig"/>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <button type="submit" class="btn btn-primary">上传</button>
                        </div>
                    </form>
                </div>
                <!-- /.modal-content -->
            </div>
        </div>
        <%--保存系统--%>
        <div class="modal fade" id="saveSystemModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="">新增业务系统</h4>
                    </div>
                    <form id="saveOrUpdateForm" role="form" action="${basePath}/configs4system" method="post">
                        <div class="modal-body">
                            <div class="form-group">
                                <label>系统名称</label>
                                <input class="form-control" name="systemName" placeholder="系统名称">
                            </div>
                            <input type="hidden" name="operation" value="save">
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <button type="submit" class="btn btn-primary">保存</button>
                        </div>
                    </form>
                </div>
                <!-- /.modal-content -->
            </div>
        </div>
        <%--删除弹框--%>
        <div class="modal fade" id="deleteSystemModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="deleteModalLabel">删除业务系统</h4>
                    </div>
                    <form id="deleteSystemForm" role="form" action="${basePath}/configs4system" method="post">
                        <div class="modal-body">
                            确定删除该业务系统吗?
                            <input type="hidden" name="systemName">
                            <input type="hidden" name="operation" value="delete">
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <button type="submit" class="btn btn-primary">确定</button>
                        </div>
                    </form>
                </div>
                <!-- /.modal-content -->
            </div>
        </div>

    </div>
</div>
<!-- 页面依赖js文件 -->
<%@include file="/resource/common/scripts.jsp" %>
</body>
</html>
